package com.orangelife.mobile.individual.adapter;

import java.util.List;
import java.util.Map;

import com.curry.orangelife.mobile.R;
import com.curry.android.adapter.FatherAdapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

/**
 * 业主验证信息的适配器
 * 
 * @author lxj
 * 
 */
@SuppressWarnings("hiding")
public class OwnerValidateListViewAdapter<T> extends FatherAdapter<T> {

	private Context mContext;
	private List<Map<String, Object>> list;

	public OwnerValidateListViewAdapter(Context context,
			List<Map<String, Object>> list) {
		this.mContext = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@SuppressWarnings("unchecked")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		ViewHolder holder;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(mContext).inflate(
					R.layout.item_owner_validate_info, null);
			holder.tvAddress = (TextView) convertView
					.findViewById(R.id.tvValidateAddress);

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		return convertView;
	}

	class ViewHolder {
		/* 地址 */
		private TextView tvAddress;
	}

	@SuppressWarnings("unchecked")
	@Override
	public BaseAdapter setList(List<T> list) {
		this.list = (List<Map<String, Object>>) list;
		return OwnerValidateListViewAdapter.this;
	}

}